package com.yuyuto.conn.subscriber;

import com.yuyuto.conn.exception.ApiException;

import rx.Subscriber;

/**
 * Created by Demon on 2016/11/28.
 */

public abstract class ErrorSubscriber<T> extends Subscriber<T> {

    @Override
    public void onError(Throwable e) {
        if (e instanceof ApiException) {
            onError((ApiException) e);
        } else {
            onError(new ApiException(e, 123));
        }
    }

    /**
     * 错误回调
     */
    protected abstract void onError(ApiException ex);
}
